<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>异步编程-3</title>
</head>

<!-- 注意：既然 setTimeout 会在子线程中等待 3 秒，在 setTimeout 函数执行之后主线程并没有停止， -->

<body>
    <p>回调函数等待 3 秒后执行。</p>
    <p id="demo1"></p>
    <p id="demo2"></p>
    <script>
        setTimeout(function () {
            document.getElementById("demo1").innerHTML = "RUNOOB-1!";
        }, 3000);
        document.getElementById("demo2").innerHTML = "RUNOOB-2!";
    </script>
</body>

</html>